var uniqueInOrder = function (iterable) {
    let ans = []
    let test = iterable instanceof Array ? iterable : iterable.split("")
    while (test.length > 0) {
        let cur = test.pop()
        if (cur != ans[0]) ans.unshift(cur)
    }
    return ans
}

// 改进后
uniqueInOrder = function (iterable) {
    let ans = []
    // let test = iterable instanceof Array?iterable:iterable.split("")
    // while(test.length>0){
    for (let i = iterable.length; i >= 0; i--) {
        if (iterable[i] != ans[0]) ans.unshift(iterable[i])
    }
    // }
    return ans
}
console.log(uniqueInOrder("ABBCcAD"));